const {Service} = require('egg');
class NewsService extends Service{
    async list(){
        let {ctx,config} = this;
        let response = await ctx.curl(config.newsUrl,{
            method:'GET',
            dataType:'json'//告诉服务器，我需要什么样的响应体
        });
        //console.log(response);// 响应头 状态码 响应体  headers code data
        //result.data指的是真正的响应体
        return response.data.data;
    }
}
module.exports = NewsService;